<template>
	<view class="body">
		<view class="page">
			<input type="number" v-model="money" class="inp" :disabled="operability==0?true:false" placeholder="¥ 请输入提现金额">
			<view class="text">
				<text>当前可提现金额: {{operability}}</text>
				<text @click="operability==0?'':all()" :style="operability==0?'color: #d5d5d5;':'color: #0071FE;'">全部提现</text>
			</view>
			<view class="flex j-c a-c">
				<button class="js-image-a" type="default "
					style="margin: 20rpx;background-color: #0071FE;width: 600rpx;color: #fff;border-radius: 45rpx;"
					@tap="operability==0?'':save()">
					<text class="p20">提交申请</text>
				</button>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				money: '',
				operability:0
			}
		},
		onShow() {
			let user = uni.getStorageSync('user')
			let fundsDTO = uni.getStorageSync('fundsDTO')
			console.log(user,fundsDTO)
			if (user.itype == 1 && fundsDTO) {
				this.operability = fundsDTO.virtualCurrencyAvailable
			} else if (user.itype == 2 && fundsDTO) {
				this.operability = fundsDTO.currencyAvailable
			} else {
				this.$module.showToast('数据获取未知异常')
			}
		},
		methods: {
			all() { //全部提现
				this.money =this.operability
				let user = uni.getStorageSync('user')
				let fundsDTO = uni.getStorageSync('fundsDTO')
				if (user.itype == 1) {
					this.money = fundsDTO.virtualCurrencyAvailable
				} else if (user.itype == 2) {
					this.money = fundsDTO.currencyAvailable
				} else {
					this.$module.showToast('操作失败')
				}
			},
			save(){//提交申请
				
			}
		}
	}
</script>

<style lang="less" scoped>
	.body {
		height: 100vh;
		overflow: hidden;
		background-color: #eee;
		// display: flex;
		// align-items: center;
		// justify-content: center;
	}

	.page {
		margin-top: 100rpx;

		.text {
			text-align: center;
			padding: 30rpx 0;
			margin:0 10%;
			display: flex;
			justify-content: space-between;
		}

		.inp {
			background-color: #fff;
			width: 80%;
			height: 70rpx;
			margin: 0 auto;
			padding-left: 1em;
			font-weight: bold;
		}
	}
</style>